<?php
class BrandSlider extends CWidget
{
	public $postParams=array();
	public $config=array();
	public $page;
	
	public function run()
  	{
  		?>
  	
<div class="brand_slider_wrap">

	<link rel="stylesheet" href="<?php echo ApplicationConfig::app()->params['theme']['cssUrl']?>default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php echo ApplicationConfig::app()->params['theme']['cssUrl']?>nivo-slider.css" type="text/css" media="screen" />
    <div id="wrapper">
        <div class="slider-wrapper theme-default">
            <div id="slider" class="nivoSlider">
            	<?php 
            	if (empty($this->page))
            	$bannerImages = BannerDetails::getList("SLIDER-IMAGES", array());
            	elseif ($this->page=="brands") 
            	$bannerImages = BannerDetails::getList("SLIDER-IMAGES", array('page'=>$this->page));
            	if (!empty($bannerImages)){
            		foreach ($bannerImages as $bannerImage){
            	?>
             	<img src="<?php echo ApplicationConfig::getImageUrl("BANNER-IMAGES", array('file_name'=>$bannerImage->filename));?>" height="277px" width="619px"/>
              
                <?php } }
                else {?>
                <img src="<?php echo ApplicationConfig::app()->params['theme']['imageUrl']?>no_preview.jpg" data-transition="slideInLeft" height="277px" width="619px"/>
                <?php }?>
            </div>
            
        </div>

    </div>
    <script type="text/javascript" src="<?php echo ApplicationConfig::app()->params['theme']['jsUrl']?>jquery.nivo.slider.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider();
    });
    </script>

</div>
  	<?php }
}
?> 